<html lang="en" xmlns:th="http://www.thymeleaf.org">

<div th:fragment="fragment-name1" id="fragment-id1">
    <div style="background-color: chartreuse;width: 100px;height: 100px;">这里是DIV</div>
</div>

<div th:fragment="fragment-name2(userName,password)" id="fragment-id2">
    <div style="background-color: chartreuse;width: 100px;height: 100px;" th:text="${userName}+'|'+${password}">这里是DIV</div>
    <div style="background-color: chartreuse;width: 100px;height: 100px;" th:text="|${userName}abdef${password}|">这里是DIV</div>
</div>

<div th:fragment="fragment-name3" id="fragment-id3">
    <div style="background-color: chartreuse;width: 100px;height: 100px;">这里是DIV</div>
</div>

<div th:fragment="fragment-name4" id="fragment-id4">
    <div style="background-color: chartreuse;width: 100px;height: 100px;">这里是DIV</div>
</div>